$(function() {

	// Append an emoticon bar before comment-form
	$(putEmoAbove).before('<div class="emoWrap"> :) :( ^_^ :D ;) :-bd :&#39;( :&#92; :p B) :Q :Ozz 7:( &#92;o/ **p &lt;3 0:) :-a 7:O *fck* x@ X@ ~x(</div>');

	var emo = function(emo, imgRep, emoKey) {
		$(emoRange).each(function() {
			$(this).html($(this).html().replace(emo, " <img src='" + imgRep + "' class='emo' alt='" + emoKey + "' />"));
		});
	}
  
emo(/\s;\)\)/gi, "http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/71.gif", ";))");
	emo(/\s;\;\)/gi, "http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/5.gif", ":)");
	emo(/\s:\)+/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/smile.gif", ":)");
	emo(/\s=\)\)/ig,"http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/24.gif", "=))");
	emo(/\s;\)+/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/wink.gif", ";)");
	emo(/\s:\(/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/sad.gif", ":(");
	emo(/\s:\\/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/memble.gif", ":&#92;");
	emo(/\s:D/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/haha.gif", ":D");
	emo(/\s\^(\_|)\^/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/senyum-tulus.gif", "^_^");
	emo(/\s:'\(/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/cry.gif", ":&#39;(");
	emo(/\sB\)/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/cool.gif", "B)");
	emo(/\s:Q/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/smoking.gif", ":Q");
	emo(/\s\*\*p/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/crazy.gif", "**p");
	emo(/\s7:\(/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/conf.gif", "7:(");
	emo(/\s:p/ig, "http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif", ":p");
emo(/\s:t/ig, "http://www.babaflash.com/forum/images/smilies/cluebat.gif", ":t");
emo(/\s:m/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/baba_mikir-01.gif", ":m");
emo(/\s:h/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/baba_tertawajahat-01.gif", ":h");
emo(/\s:u/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/baba_ups-01.gif", ":u");
emo(/\s:v/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/yahoo_peace.gif", ":v");
	emo(/\s:Oz+/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/sleep.gif", ":Ozz");
	emo(/\s7:O/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/angry.gif", "7:O");
	emo(/\s\\(m|o)\//ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/applause.gif", "&#92;o/");
	emo(/\s&lt;3/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/love.gif", "&amp;amp;lt;3");
	emo(/\s0:\)+/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/angelgreen.gif", "0:)");
	emo(/\s:-a/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/vomit.gif", ":-a");
	emo(/\s\*fck\*/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/fuck.gif", "*fck*");
	emo(/\sx\@/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/marahbesar.gif", "x@");
	emo(/\s\X\@/g, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/arrgh.gif", "X@");
	emo(/\s:-bd/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/topmarkotop.gif", ":-bd");
	emo(/\s\~x\(+/ig, "http://projekpustaka.googlecode.com/svn/trunk/My%20Pictures/wee.gif", "~x(");

	// Show alert one times!
	$('div.emoWrap').one("click", function() {
		alert(emoMessage);
	});
	// Click to show the code!
	$('img.emo').css('cursor', 'pointer').live("click", function(e) {
		$('input.emoKey').remove();
		$(this).after('<input class="emoKey" type="text" size="' + this.alt.length + '" value=" ' + this.alt + '" />');
		e.stopPropagation();
	});
	$('input.emoKey').live("click", function() {
		$(this).focus().select();
	});

});